package com.eddie.responsibilitychain;

/**
 * @author Eddie
 * @date 2022/08/08 15:57
 **/
public class Client {
    public static void main(String[] args) {
        PurchaseRequest purchaseRequest = new PurchaseRequest(1, 31000, 1);
        //创建相关审批人
        DepartmentAppRover department = new DepartmentAppRover("主人");
        CollegeAppRover college = new CollegeAppRover("院长");
        ViceSchoolMasterAppRover viceSchoolMaster = new ViceSchoolMasterAppRover("副校长");
        SchoolMasterAppRover schoolMaster = new SchoolMasterAppRover("校长");

        //将各个审批级别的下一个设置好（处理人构成环形：）
        department.setAppRover(college);
        college.setAppRover(viceSchoolMaster);
        viceSchoolMaster.setAppRover(schoolMaster);
        //最大的的下一个为最小的，就能形成环形
        schoolMaster.setAppRover(department);
        department.processRequest(purchaseRequest);
    }
}
